package com.elm.mapper;

import com.elm.po.Awards;
import org.apache.ibatis.annotations.*;

import java.math.BigDecimal;
import java.util.List;

@Mapper
public interface AwardsMapper {
    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "recharge_amount", column = "recharge_amount"),
            @Result(property = "award_amount", column = "award_amount")
    })
    @Select("SELECT * FROM recharge")
    List<Awards> getAwards();

    @Update("update recharge set recharge_amount=#{recharge_amount},award_amount=#{award_amount} where id=#{id}")
    boolean updateAwards(Long id, BigDecimal recharge_amount, BigDecimal award_amount);

    @Insert("INSERT INTO recharge (" +
            " id, " +
            "recharge_amount, award_amount " +
            ") VALUES (" +
            "#{id}, " +
            "#{recharge_amount}, #{award_amount} " +
            ")")
        boolean insertAwards(Long id, BigDecimal recharge_amount, BigDecimal award_amount);

    @Delete("DELETE FROM recharge where id=#{id}")
    boolean deleteAwards(Long id);
}
